package cn.iocoder.yudao.module.product.dal.mysql.fixprice;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.product.dal.dataobject.fixprice.FixPriceDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.product.controller.admin.fixprice.vo.*;

/**
 * 商品定价 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface FixPriceMapper extends BaseMapperX<FixPriceDO> {

    default PageResult<FixPriceDO> selectPage(FixPricePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FixPriceDO>()
                .eqIfPresent(FixPriceDO::getSkuId, reqVO.getSkuId())
                .eqIfPresent(FixPriceDO::getSpuId, reqVO.getSpuId())
                .eqIfPresent(FixPriceDO::getProductSpecifId, reqVO.getProductSpecifId())
                .eqIfPresent(FixPriceDO::getPackagingId, reqVO.getPackagingId())
                .eqIfPresent(FixPriceDO::getUnifiedPricing, reqVO.getUnifiedPricing())
                .eqIfPresent(FixPriceDO::getUnitPrice, reqVO.getUnitPrice())
                .eqIfPresent(FixPriceDO::getNetWeight, reqVO.getNetWeight())
                .betweenIfPresent(FixPriceDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(FixPriceDO::getId));
    }

}